package com.cq.hd.member.controller;

import com.cq.hd.common.pagination.Page;
import com.cq.hd.common.response.Result;
import com.cq.hd.common.response.ResultGenerator;
import com.cq.hd.member.api.TbMemberFeeBillApi;
import com.cq.hd.member.api.dto.AdminMemberFeeBillPageDto;
import com.cq.hd.member.api.vo.AdminMemberFeeBillPageVo;
import com.cq.hd.member.service.TbMemberFeeBillService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * <p>
 * 会员套餐开通流水表 前端控制器
 * </p>
 *
 * @author mYunYu
 * @since 2023-12-21
 */
@RestController
public class TbMemberFeeBillController implements TbMemberFeeBillApi {

    @Autowired
    private TbMemberFeeBillService memberFeeBillService;

    @ApiOperation(value = "会员开通续费记录列表")
    @ApiResponse(response = AdminMemberFeeBillPageVo.class, code = 200, message = "接口返回对象参数")
    @Override
    public Result<Page<AdminMemberFeeBillPageVo>> pageAdminMemberFeeBill(AdminMemberFeeBillPageDto adminMemberFeeBillPageDto) {
        return ResultGenerator.success(memberFeeBillService.pageAdminMemberFeeBill(adminMemberFeeBillPageDto));
    }

    @ApiOperation(value = "清空3天前的待支付的会员续费记录")
    @Override
    public Result<Boolean> removeWaitPayJob() {
        return ResultGenerator.success(memberFeeBillService.removeWaitPayJob());
    }

    @ApiOperation(value = "查询累计成交金额")
    @Override
    public Result<BigDecimal> getTotalAmt() {
        return ResultGenerator.success(memberFeeBillService.getTotalAmt());
    }

}
